import type { FormInstance, FormRules } from "element-plus";
import { reactive, ref } from "vue";

export function useVolRegist() {
  const volunRef = ref<FormInstance>();
  const volunForm = reactive({
    v_name: "",
    v_sex: "",
    v_birthday: "",
    v_phone: "",
    v_wechat: "",
    v_email: "",
    v_age: "",
    v_politic: "",
    v_cardId: "",
    v_addr: "",
    v_works: "",
    v_hobbies: "",
    v_line: "",
    v_serve: "",
  });
  const volunRules = reactive<FormRules>({
    v_name: [{ required: true, message: "必填", trigger: "blur" }],
    v_sex: [{ required: true, message: "必填", trigger: "blur" }],
    v_birthday: [{ required: true, message: "必填", trigger: "blur" }],
    v_phone: [{ required: true, message: "必填", trigger: "blur" }],
    v_wechat: [{ required: true, message: "必填", trigger: "blur" }],
    v_email: [{ required: true, message: "必填", trigger: "blur" }],
    v_age: [{ required: true, message: "必填", trigger: "blur" }],
    v_politic: [{ required: true, message: "必填", trigger: "blur" }],
    v_cardId: [{ required: true, message: "必填", trigger: "blur" }],
    v_addr: [{ required: true, message: "必填", trigger: "blur" }],
    v_works: [{ required: true, message: "必填", trigger: "blur" }],
    v_hobbies: [{ required: true, message: "必填", trigger: "blur" }],
    v_line: [{ required: true, message: "必填", trigger: "blur" }],
    v_serve: [{ required: true, message: "必填", trigger: "blur" }],
  });

  return {
    volunRef,
    volunForm,
    volunRules,
  };
}
